package com.ap.core.common.types;

import com.ap.core.cxf.jaxb.msghdr.MessageType;

/**
 * User: Ranjit.Singh
 */
public enum InputMessageType {

    SUBMITRTPFORMOB(MessageType.SUBMITRTPFORMOB, MessageType.RESPONSETORTP, SystemTypeCode.DISTRIBUTOR, SystemTypeCode.AP, EventTypeCode.TRANSITION,
                    SystemTypeCode.AP, SystemTypeCode.DISTRIBUTOR, EventTypeCode.TRANSITION),

    SUBMITRTPFORBRN(MessageType.SUBMITRTPFORBRN, MessageType.RESPONSETORTP, SystemTypeCode.DISTRIBUTOR, SystemTypeCode.AP, EventTypeCode.TRANSITION,
            SystemTypeCode.AP, SystemTypeCode.DISTRIBUTOR, EventTypeCode.TRANSITION),

    SUBMITRTPFORBILLPAY(MessageType.SUBMITRTPFORBILLPAY, MessageType.RESPONSETORTP, SystemTypeCode.DISTRIBUTOR, SystemTypeCode.AP, EventTypeCode.TRANSITION,
                        SystemTypeCode.AP, SystemTypeCode.DISTRIBUTOR, EventTypeCode.TRANSITION),


   RETRIEVERTP(MessageType.RETRIEVERTP, MessageType.RTPFORAUTH, SystemTypeCode.FI, SystemTypeCode.AP, EventTypeCode.TRANSITION,
         SystemTypeCode.AP, SystemTypeCode.FI, EventTypeCode.TRANSITION),

    ADDMERCHANT(MessageType.ADDMERCHANT, MessageType.ACKADDMERCHANT, SystemTypeCode.DISTRIBUTOR, SystemTypeCode.AP, EventTypeCode.ONBOARDING,
                   SystemTypeCode.AP, SystemTypeCode.DISTRIBUTOR, EventTypeCode.ONBOARDING),
                   

    CONFIRMPAYMENT(MessageType.CONFIRMPAYMENT, MessageType.RSPTOPAYMENTCONFIRMATION, SystemTypeCode.FI, SystemTypeCode.AP, EventTypeCode.TRANSITION,
                           SystemTypeCode.AP, SystemTypeCode.DISTRIBUTOR, EventTypeCode.TRANSITION),

    REGISTERCONSUMER(MessageType.REGISTERCONSUMER, MessageType.ACKCONSREGISTRATION, SystemTypeCode.FI, SystemTypeCode.AP, EventTypeCode.ONBOARDING,
                   SystemTypeCode.AP, SystemTypeCode.FI, EventTypeCode.ONBOARDING),

    REQCONSREGSTATUS(MessageType.REQCONSREGSTATUS, MessageType.RESPCONSREGSTATUS, SystemTypeCode.FI, SystemTypeCode.AP, EventTypeCode.ONBOARDING,
		   SystemTypeCode.AP, SystemTypeCode.FI, EventTypeCode.ONBOARDING),
    
    GETACCFORREFUND(MessageType.GETACCFORREFUND, MessageType.RSPGETACCFORREFUND, SystemTypeCode.DISTRIBUTOR, SystemTypeCode.AP, EventTypeCode.TRANSITION,
 		   SystemTypeCode.AP, SystemTypeCode.DISTRIBUTOR, EventTypeCode.TRANSITION),

    REQUESTRTPSTATUS(MessageType.REQUESTRTPSTATUS, MessageType.RESPONSETORTPSTATUS, SystemTypeCode.DISTRIBUTOR, SystemTypeCode.AP, EventTypeCode.ADHOC,
                     SystemTypeCode.AP, SystemTypeCode.DISTRIBUTOR, EventTypeCode.ADHOC);
    
    
    
    

    private MessageType inputMsgTypeEnum;
    private MessageType outputMsgTypeEnum;
    private SystemTypeCode inputSenderTypeCode;
    private SystemTypeCode inputDestinationTypeCode;
    private EventTypeCode inputEventTypeCode;
    private SystemTypeCode outputSenderTypeCode;
    private SystemTypeCode outputDestinationTypeCode;
    private EventTypeCode outputEventTypeCode;

    private InputMessageType(MessageType inputMsgTypeEnum, MessageType outputMsgTypeEnum, SystemTypeCode inputSenderTypeCode,
                             SystemTypeCode inputDestinationTypeCode, EventTypeCode inputEventTypeCode,
                             SystemTypeCode outputSenderTypeCode, SystemTypeCode outputDestinationTypeCode, EventTypeCode outputEventTypeCode
                             ) {
        this.inputMsgTypeEnum = inputMsgTypeEnum;
        this.outputMsgTypeEnum = outputMsgTypeEnum;
        this.inputSenderTypeCode = inputSenderTypeCode;
        this.inputDestinationTypeCode = inputDestinationTypeCode;
        this.inputEventTypeCode = inputEventTypeCode;
        this.outputDestinationTypeCode=outputDestinationTypeCode;
        this.outputEventTypeCode = outputEventTypeCode;
        this.outputSenderTypeCode = outputSenderTypeCode;
    }

    public MessageType getInputMsgTypeEnum() {
        return inputMsgTypeEnum;
    }

    public SystemTypeCode getInputDestinationTypeCode() {
        return inputDestinationTypeCode;
    }

    public EventTypeCode getInputEventTypeCode() {
        return inputEventTypeCode;
    }

    public MessageType getOutputMsgTypeEnum() {
        return outputMsgTypeEnum;
    }

    public SystemTypeCode getInputSenderTypeCode() {
        return inputSenderTypeCode;
    }

    public SystemTypeCode getOutputDestinationTypeCode() {
        return outputDestinationTypeCode;
    }

    public EventTypeCode getOutputEventTypeCode() {
        return outputEventTypeCode;
    }

    public SystemTypeCode getOutputSenderTypeCode() {
        return outputSenderTypeCode;
    }

    public static InputMessageType getMessageType(String msgTypeEnum) {

        InputMessageType inputMessageType = null;
        switch (msgTypeEnum) {
            case "SUBMITRTPFORMOB":
                inputMessageType = InputMessageType.SUBMITRTPFORMOB;
                break;
            case "SUBMITRTPFORBRN":
                inputMessageType = InputMessageType.SUBMITRTPFORBRN;
                break;
            case "RETRIEVERTP":
                inputMessageType = InputMessageType.RETRIEVERTP;
                break;
            case "SUBMITRTPFORBILLPAY":
                inputMessageType = InputMessageType.SUBMITRTPFORBILLPAY;
                break;
            case "ADDMERCHANT":
                inputMessageType = InputMessageType.ADDMERCHANT;
                break;
            case "CONFIRMPAYMENT":
                inputMessageType = InputMessageType.CONFIRMPAYMENT;
                break;
            case "REGISTERCONSUMER":
                inputMessageType = InputMessageType.REGISTERCONSUMER;
                break;
            case "REQCONSREGSTATUS":
                inputMessageType = InputMessageType.REQCONSREGSTATUS;
                break;  
            case "GETACCFORREFUND":
                inputMessageType = InputMessageType.GETACCFORREFUND;
                break;
            case "REQUESTRTPSTATUS":
                inputMessageType = InputMessageType.REQUESTRTPSTATUS;
                break;
            default:
                // not found
                throw new IllegalArgumentException("Unable to determine message type: inputMsgType= " + inputMessageType);
        }
        return inputMessageType;
    }


}
